import java.util.*;



public class ProvenanceTracker {
    
    private ProvenanceAdapter pAdapter;
    
    private ArrayList<String> logMessageTypes;
    
//    private int currentMessageType;
    
    public ProvenanceTracker() {
        pAdapter = new ProvenanceAdapter();
//        currentMessageType = -1;
        
        logMessageTypes = new ArrayList<String>();
        logMessageTypes.add(0, "DAY SEGMENT MAX TEMPERATURE");
        logMessageTypes.add(1, "DAY MAX TEMPERATURE AVERAGE");
        logMessageTypes.add(2, "THRESHOLD TEMPERATURE");
        logMessageTypes.add(3, "RESULTS");
    }
    
//    public void log(String logMessage) {
//        System.err.println(new Date().toString() + ": " + logMessage);
//        
//    }
    
    public void log(int messageType, int x, int y, int day, int hour, double temp, boolean writeToConsole) {
        String now = new Date().toString();
        pAdapter.writeToStorage(now + ": " + logMessageTypes.get(messageType) + ": (DAY " + day + ", HOUR " + hour + ") (" + x + ", " + y + ") = " + temp);
        
        if( writeToConsole == true) {
            System.err.println(now + ": " + logMessageTypes.get(messageType) + ": (DAY " + day + ", HOUR " + hour + ") (" + x + ", " + y + ") = " + temp);
            //write to storage
        }
    }
    
//    public void setLogType(int type) {
//        currentMessageType = type;
//    }
    
}